#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n;
    double *a = 0;
    scanf("%d", &n);
    a = (double *)malloc(n * sizeof(double));
    for (int i = 0; i < n; i++)
    {
        scanf("%lf", &a[i]);
    }
    double s = 0.0, maxN = a[0], minN = a[0];
    for (int i = 0; i < n; i++)
    {
        s += a[i];
        if (a[i] > maxN)maxN = a[i];
        if (a[i] < minN)minN = a[i];
    }
    double avg = (s - maxN - minN) / (n - 2);
    printf("%.2f", avg);
    free(a);

    return 0;
}